import request from '@/utils/request'
import global from '@/global.js'

const url = '/Common'

export function getFileList(query) {
    return request({
        url: url + '/GetFileList',
        method: 'get',
        params: query
    })
}





export function getuploadDate(data) {
    return request({
        url: "/Common/GetUploadFileDate",
        method: 'post',
        data: data
    })
}

export function deleteFile(data) {
    return request({
        url: "/Common/DeleteFile",
        method: 'post',
        data: data
    })
}
export function getupload(uploadUrl, data) {
    return request({
        url: "/Common/UploadFile" + uploadUrl,
        method: 'post',
        contentType: 'application/json;charset=UTF-8',
        data: data,
        upload: true
    })
}

export function downloadFile(params) {

    //因为部署了文件服务器，直接用url
    var windowtmp = window.open(params.path, "_blank");

    //取相对路径
    // var windowtmp = window.open(global.host + '/api' + url + "/DownloadFile?fileName=" +
    //   params.fileName +
    //   "&path=" +
    //   params.path, "_blank");

    // window.location.href = global.host + '/api' + url + "/DownloadFile?fileName=" +
    //   params.fileName +
    //   "&path=" +
    //   params.path;
    // console.log(params)

    // return request({
    //   url: url ,
    //   method: 'get',
    //   params: params
    // })
}